home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1996
/
MacHack 1996.toast
/
Hacks
/
Hacks ’92
/
Text Capture FKEY
/
Text Capture source.cpt
/
_* Overview *_.c
< prev
next >
Wrap
Text File
|
1992-06-12
|
2KB
|
50 lines
#if justacomment
Text Capture FKEY
by James W. Walker, 1992.
76367.2271@compuserve.com
Copies text from the front window to the clipboard, for applications
like THINK Reference 1.0 that do not support normal copying.
Main routine:
* Make a locked copy of itself and call it. This is because
the Event Manager unlocks an FKEY after running it, but our
patches need to stay around longer.
* Find and read the preferences file, or if it is not found,
create it.
* If caps lock or control is down, show the configuration dialog,
then quit. Otherwise proceed normally.
* Depending on the preferences, maybe change the cursor to a cross-
hair and wait for the user to select a rectangle.
* Invalidate the front window, or a part thereof.
* Patch _BeginUpDate and _EndUpDate.
_BeginUpDate patch:
* When there is an update event for the front window,
call Begin_copy().
Begin_copy():
* create a new GrafPort for the TEHandle
* create TEHandle for captured text
* patch stdText bottleneck for front window
stdText patch:
* Accumulate styled text into TEHandle. Use the vertical
coordinate to tell whether we're on a new line, in which case
we may want to insert a return as a line separator.
_EndUpDate patch:
* After the update event for the front window,
call End_copy().
* Use some assembly language trickery to dispose of the handle
containing the patch.
End_copy():
* unpatch stdText
* put text on clipboard
* dispose of TEHandle
* close our GrafPort
* unpatch _BeginUpDate and _EndUpDate.
#endif